<?php


namespace app\admin\model\meal;


use app\common\model\TimeModel;
use app\common\constants\MenuConstant;

use think\model\Pivot;
class Package extends TimeModel
{
    protected $name = 'package';
    public function packageAttr()
    {
        return $this->hasMany(PackageAttr::class,'package_id');
    }
 
    // public static function onAfterUpdate($data)
    // {   
       
    //     $data=$data->toArray();
    //     if(!empty($data['son'])){
    //         foreach ($data['son'] as $k => $v) {
            
    //             $data['son'][$k]['package_id']=$data['id'];
                
    //         }
    //         $SpecItem=new PackageAttr();
    //         $SpecItem->where('package_id',$data['id'])->delete();
    //         $SpecItem->saveAll($data['son']);
    //     }
        
    // }
}